import axios from 'axios';
import {HOST} from '@/api/service';

// ****************************************************** 发现音乐 ********************************************************************
//发现音乐 --获取个性推荐-- banner
export function getBanner(){
  const url = HOST + '/banner?type=0';
  return axios.get(url);
}

//发现音乐 -- 获取个性推荐-- 推荐歌单
export function getRecommendSongs(num){
  const url = HOST + `/personalized?limit=${num}`;
  return axios.get(url);
}

//发现音乐 -- 获取个性推荐-- 独家放送
export function getSole(){
  const url = HOST + '/personalized/privatecontent?limit=3';
  return axios.get(url);
}

//发现音乐 -- 获取个性推荐-- 最新音乐
export function getNewMusic(){
  const url = HOST + '/personalized/newsong?limit=10';
  return axios.get(url);
}

//发现音乐 -- 获取个性推荐-- 推荐MV
export function getRecommendMV(){
  const url = HOST + '/personalized/mv';
  return axios.get(url);
}

//发现音乐 -- 获取个性推荐-- 推荐电台
export function getRecommendDj(){
  const url = HOST + '/personalized/djprogram?limit=6';
  return axios.get(url);
}


// 发现音乐 -- 歌单 -- 分类名
export function getSonglistName(){
  const url = HOST + '/playlist/catlist';
  return axios.get(url);
}

// 发现音乐 -- 歌单 -- 歌单分类(网友精选碟)
export function getSonglistAll(tag){
  const url = HOST +  `/top/playlist?limit=100&cat=${tag}`;
  return axios.get(url);
}

//发现音乐  --- 歌手 -- 热门歌手
export function getHotSinger(){
  const url = HOST + '/top/artists?limit=100';
  return axios.get(url);
}


// ****************************************************** 搜素 ********************************************************************
//热门搜索
export function getHotSearch(){
  const url = HOST + '/search/hot'
  return axios.get(url);
}

//搜索建议
export function getSearchAdvise(keyword){
  const url = HOST + `/search/suggest?keywords=${keyword}&type=pc`
  return axios.get(url)
}

// 搜索结果
export function getSearchResult(keyword,num){
  const url = HOST + `/search?keywords=${keyword}&type=${num}`
  return axios.get(url)
}


// ****************************************************** MV ********************************************************************
// 精选 -- 网易出品
export function getWycp(){
  const url  = HOST + `/mv/exclusive/rcmd?limit=3`
  return axios.get(url)
}

// 精选 -- 最新MV
export function getNewMV(){
  const url = HOST + `/mv/first?limit=12`
  return axios.get(url)
}

// 排行榜
export function getMVRank(){
  const url = HOST + `/top/mv?limit=50`
  return axios.get(url)
}

// 全部
export function getMVAll(){
  const url = HOST + `/mv/all?limit=100`
  return axios.get(url)
}

// ****************************************************** 朋友 ********************************************************************
export function getFriendDynamic(){
  const url = HOST + `/event?pagesize=30&lasttime=1556740526369`
  return axios.get(url)
}


// ****************************************************** 歌曲详情 ********************************************************************
// 歌单详情
export function getSongListDetail(id){
  const url = HOST + `/playlist/detail?id=${id}`
  return axios.get(url)
}

// ****************************************************** 歌手详情 ********************************************************************
//歌手单曲
export function getSingerdHot(id){
  const url = HOST + `/artists?id=${id}`
  return axios.get(url)
}
// 歌手专辑
export function getSingerdZJ(id){
  const url = HOST + `/artist/album?id=${id}`
  return axios.get(url)
}
// 歌手MV
export function getSingerdMV(id){
  const url = HOST + `/artist/mv?id=${id}&limit=30`
  return axios.get(url)
}
// 歌手详情
export function getSingerdDetail(id){
  const url = HOST + `/artist/desc?id=${id}`
  return axios.get(url)
}
// 相似歌手
export function getSingerdAlike(id){
  const url = HOST + `/simi/artist?id=${id}`
  return axios.get(url)
}

// ****************************************************** 专辑详情 ********************************************************************
// 专辑详情
export function getAlbumd(id){
  const url = HOST + `/album?id=${id}`
  return axios.get(url)
}

// ****************************************************** 音乐详情 ********************************************************************
export function getMusicUrl(id){
  const url = HOST + `/song/url?id=${id}`
  return axios.get(url)
}
export function getMusicInfo(id){
  const url = HOST + `/song/detail?ids=${id}`
  return axios.get(url)
}